package com.imooc.news_manager_project.common;

import com.imooc.news_manager_project.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Component
public class CommonMethods {
    @Autowired
    private RedisUtil redisUtil;

    public Map getLoginUserInfo(HttpServletRequest request){
        String token = request.getHeader("token");
        Map map = (Map) redisUtil.get(token);
        return map;
    }
}
